<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body {
            margin: 0;
            background-color: black;
        }

        img {
            position: absolute;
        }

    </style>
</head>
<body>
<script src="../jq.js"></script>
<script>
    //开启定时器添加雪花图片
    setInterval(function () {
        let img = $("<img src='snow.png'>");
        $("body").append(img);
        //得到二十到四十的随机大小
        let size = parseInt(Math.random() * 21) + 20
        img.css("width", size + "px");

        //让雪花随机出现在屏幕的顶部
        let w = $(window).width();
        let h = $(window).height();
        let left = parseInt(Math.random() * (w - size));
        img.css("left", left + "px");
        //让雪花从上往下移动

        img.animate({"top": h - size + "px"}, size*100)
            .fadeOut(1000, function () {
                img.remove()
            })
    }, 10)
</script>
</body>
</html>